/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Graphics;

import java.util.*;
import Settings.*;
import Graphics.Sprite.*;
import Enums.bmpSize;
/**
 *
 * @author Martin
 */
public class Menu
{
    static int menuHeight = 400, menuWidth = 600;
    public Menu()
    {

    }

    public static void drawMenu( Vector<String> vec )
    {
        int heightTex, widthTex;
        int heightPos;

        Sprite.drawNewTexture("Menu600x400.bmp"     , Settings.wWidth/2 - menuWidth/2 , Settings.wHeight/2 - menuHeight/2 , menuWidth , menuHeight );

        for( int i = 0 ; i < vec.size() ; ++i )
        {
            try
            {
                widthTex = returnWidth(vec.elementAt(i));
                heightTex = returnDefaultHeight();
                heightPos = Settings.wHeight/2 - bmpSize.HEIGHT_MENU.code/2 + bmpSize.BOARDER_SPACE.code + i * (bmpSize.HEIGHT_MENU.code - 2*bmpSize.BOARDER_SPACE.code)/(vec.size()-1) - bmpSize.DEFAULT_HEIGHT.code/2;

                Sprite.drawNewTexture( vec.elementAt(i) + ".bmp", Settings.wWidth/2 - widthTex/2 , heightPos , widthTex , heightTex );
            }
            catch( Exception e )
            {
                System.out.println(e.toString());
            }
        }
    }

    public static int returnDefaultHeight()
    {
        return bmpSize.DEFAULT_HEIGHT.code;
    }

    public static int returnWidth( String name )
    {
        if( name == "Start" )
        {
            return bmpSize.WIDTH_START.code;
        }
        else if(  name == "Exit" )
        {
            return bmpSize.WIDTH_EXIT.code;
        }
        else if( name == "Back" )
        {
            return bmpSize.WIDTH_BACK.code;
        }
        else if( name == "Gameplay" )
        {
            return bmpSize.WIDTH_GAMEPLAY.code;
        }
        else if( name == "Graphics" )
        {
            return bmpSize.WIDTH_GRAPHICS.code;
        }
        else if( name == "Options" )
        {
            return bmpSize.WIDTH_OPTIONS.code;
        }
        else if( name == "Standard" )
        {
            return bmpSize.WIDTH_STANDARD.code;
        }
        else if( name == "Restart" )
        {
            return bmpSize.WIDTH_RESTART.code;
        }
        else if( name == "Return to Game" )
        {
            return bmpSize.WIDTH_RETURNTOGAME.code;
        }
        else if( name == "toMainmenu" )
        {
            return bmpSize.WIDTH_TOMAINMENU.code;
        }
        else if( name == "600x400" )
        {
            return bmpSize.WIDTH_600X400.code;
        }
        else if( name == "800x600" )
        {
            return bmpSize.WIDTH_800X600.code;
        }
        else if( name == "1024x768" )
        {
            return bmpSize.WIDTH_1024X768.code;
        }
        else if( name == "1280x1024" )
        {
            return bmpSize.WIDTH_1280X1024.code;
        }
        else if( name == "On the Run")
        {
            return bmpSize.WIDTH_ONTHERUN.code;
        }
        else if( name == "Reset" )
        {
            return bmpSize.WIDTH_RESET.code;
        }
        else if( name == "Highscore" )
        {
            return bmpSize.WIDTH_HIGHSCORE.code;
        }
        else if( name == "max Level" )
        {
            return bmpSize.WIDTH_MAXLEVEL.code;
        }
        else if( name == "Select Level" )
        {
            return bmpSize.WIDTH_SELECTLEVEL.code;
        }
        else if( name == "Numbers/32_1" || name == "Numbers/32_2" || name == "Numbers/32_3" || name == "Numbers/32_4" ||  name == "Numbers/32_5" || name == "Numbers/32_6" || name == "Numbers/32_7" || name == "Numbers/32_8" || name == "Numbers/32_9" || name == "Numbers/32_0" )
        {
            return 32;
        }
        else if( name == "Multiplayer" )
        {
            return bmpSize.WIDTH_MULTIPLAYER.code;
        }
        else if( name == "Unlock Level" )
        {
            return bmpSize.WIDTH_UNLOCKLEVEL.code;
        }
        else
        {
            return 0;
        }
    }
    
}
